package com.gg.registration.hospital.controller;

import com.gg.common.result.CommonResult;
import com.gg.common.result.ResultCodeEnum;
import com.gg.registration.hospital.service.DepartmentService;
import com.gg.registration.model.hosp.Department;
import com.gg.registration.vo.hosp.DepartmentVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author chenjunjia
 * @date 2022/4/12 0:42
 */
@RestController
//@CrossOrigin
@RequestMapping("/admin/hospital/department")
public class DepartmentController {

    @Resource
    private DepartmentService departmentService;

    /**
     * 树形查询科室信息
     * @param hoscode 医院code
     * @return 统一返回结果集
     */
    @GetMapping("getDepartmentTree/{hoscode}")
    public CommonResult getDepartmentTree(@PathVariable("hoscode") String hoscode) {
        List<DepartmentVo> departmentVoList = departmentService.getDepartmentTree(hoscode);
        return new CommonResult(ResultCodeEnum.SUCCESS,departmentVoList);
    }
}
